//模版消息加工
var { Template_Id, Url, Template_Id_Note } = require('../../config');
module.exports = {
    templateMesssage(message) {
        if (message.CouponStatus == 4) {
            message.CouponStatus = '有'
        } else {
            message.CouponStatus = '无'
        }
        if (message.note == undefined) {
            message.note = '0553-5893109(中控)、0553-5840515(安环)、0553-5893101(信息)。';
        }
        var replyMessage = {
            "touser": `${message.OpenId}`,
            "template_id": `${Template_Id}`,
            "url": `${Url}/api/userinfo`,
            "topcolor": "#FF0000",
            "data": {
                "first": {
                    "value": `         ${message.DriverName}您好,车号为:${message.TruckLic}的驾驶员,您的提箱作业任务已下发,请注意以下信息:`,
                    "color": "#173177"

                },
                "keyword1": {
                    "value": `${message.ContainerID}`,
                    "color": "#173177"

                },
                "keyword2": {
                    "value": `${message.ContainerPlace}`,
                    "color": "#173177"

                },
                "keyword3": {
                    "value": `芜湖港码头${message.CouponStatus}优惠`,
                    "color": "#173177"

                },
                "keyword4": {
                    "value": `${message.Receipt_Num}`,
                    "color": "#173177"
                },
                "keyword5": {
                    "value": `${message.CreateTime}`,
                    "color": "#173177"

                },
                "remark": {
                    "value": `进堆场时请注意安全,提箱时请不要下车。如果有问题,请联系${message.note}`,
                    "color": "#87868a"

                }
            }
        }
        return replyMessage;
    },
    //提醒业务消息模版
    templateMesssageNote(message) {
        var replyMessage = {
            "touser": `${message.openid}`,
            "template_id": `${Template_Id_Note}`,
            "topcolor": "#FF0000",
            "data": {
                "first": {
                    "value": '尊敬的客户:\n' + '       ' + `${message.message}`,
                    "color": "#87868a"

                },
                "keyword1": {
                    "value": `${message.servicename}`,
                    "color": "#173177"

                },
                "keyword2": {
                    "value": `${message.time}`,
                    "color": "#173177"

                },
                "keyword3": {
                    "value": `${message.situation}`,
                    "color": "#173177"

                },
                "remark": {
                    "value": `${message.note}`,
                    "color": "#173177"

                }
            }
        }
        return replyMessage;
    }
}